<?php
/**
 * Created by PhpStorm.
 * User: zhao shou qiang
 * Date: 2018/3/5 0005
 * Time: 11:19
 */

use yii\helpers\Url;
use yii\helpers\Html;
use yii\widgets\ActiveForm;
use backend\assets\AppAsset;
use kartik\file\FileInput;

/* @var $this yii\web\View */
AppAsset::register($this);

AppAsset::addScript($this, '@web/js/officeHall/uploadAssetPackage/uploadPackage.js');
$this->title = '上传资产包基本信息';
?>
<style type="text/css">
 .content-right {
     min-height: auto; 
}
.myfooter {
	position: fixed;
	bottom: 0!important;
	left: 50%;
   transform:translateX(-50%);
   top: auto;	
}
.content .content-right .importDebtorBox {
    height: 100%;
}

.content .content-right .importDebtorBox {
     height: auto; 
}
.wrap {
     min-height: auto;
}
.wrap > .container-fluid > .container{width: 100%; padding: 0; margin: 0;}
    .edit-tabs{top: 10px;}
    .container.content.content2{top: 0;}
    .wrap{margin: 0;}   

 .content-right{
	padding-bottom: 111px!important;
}
.content .content-right .importDebtorList {
    height:auto;
}
</style>
<?php echo Html::cssFile('@web/css/officeHall/uploadAssetPackage/uploadInformation.css'); ?>
    <!--中心内容区-->
    <div class="container content">
        <div class="row">
            <div class="content-right" style="width: 100%;">
                <div class="upLoadInformation">
                    <span></span>
                    <p>上传项目清单</p>
                </div>

                <!--导入债务人清单-->
                <div class="importDebtorBox" style="display: block;">
                    <div class="upLoadList">
                        <div class="upLoadListBtn xy" align="center">
                            <?php echo Html::img('@web/image/officeHall/uploadAssetPackage/upLoadListBtn.png', ['alt' => '点击上传', 'class' => 'upload_excel']); ?>
                        </div>

                        <div class="text">
                            <p>1.仅支持模板文件上传；</p>
                            <p>
                                2.点击下载
                                <?php echo Html::a('资产包债务清单上传模板.xlsx', ['package/download']); ?>
                                补充并上传。
                            </p>
                        </div>
                    </div>
                </div>

                <!--//清单列表(三种状态)-->
                <div class="importDebtorList">
                    <div class="box">
                        <ul class="clearfix">

                            <?php $form = ActiveForm::begin([
                                'action' => ['package/upload'],
                                'method' => 'post',
                                'id' => 'myupload',
                                'options' => [
                                    'enctype' => 'multipart/form-data' //文件上传时添加该编码
                                ]
                            ]); ?>

                            <li class="pull-left ListUpLoadListBtn" id="continue_upload">
                                <?php echo Html::img('@web/image/officeHall/uploadAssetPackage/upLoadListBtn.png', ['alt' => '单击继续上传']); ?>
                            </li>

                            <li class="pull-left ListUpLoadListBtn">
                                <input type="hidden" id="package_id" name="package_id"
                                       value="<?php echo $packageid; ?>"/>

                                <input type="hidden" id="upload_access" value="refuse">

                                <input type="hidden" name="host" id="host"
                                       value="<?php echo Yii::$app->request->hostInfo . '/'; ?>">

                                <input type="hidden" name="uploadUrl" id="uploadUrl"
                                       value="<?php echo Url::toRoute('package/sync-upload-excel', true); ?>">

                                <input type="hidden" name="delExcelUrl" id="delExcelUrl"
                                       value="<?php echo Url::toRoute('package/del-excel', true); ?>">

                                <input type="hidden" name="fileName" value="">
                            </li>
                            <?php ActiveForm::end() ?>

                            <form enctype="multipart/form-data" id="upload_excel">
                                <div class="form-group">
                                    <div class="file-loading">
                                        <input id="input-20" name="UploadForm[xlsFile]" type="file" class="file" data-min-file-count="1"
                                               data-show-preview="false" ><!-- ata-show-preview="false" data-overwrite-initial="false"-->
                                    </div>
                                </div>
                            </form>
                        </ul>

                        <div class="text">
                            <p class="promptOne">
                                1. 仅支持模板文件上传;
                            </p>
                            <p class="promptTwo">
                                2.点击下载
                                <?php echo Html::a('资产包债务清单上传模板.xlsx', ['package/download']); ?>
                                补充并上传。
                            </p>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>


    <!-- 删除模态框开始（Modal） -->
    <div class="container-fluid text-center package_upload_excel">
        <div class="row">
            <div class="modal fade" id="deleModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"
                 aria-hidden="false">
                <div class="modal-dialog">
                    <div class="modal-content">
                        <div class="modal-header clearfix">
                            <div class="pull-left">
                                <?php echo Html::img('@web/image/officeHall/uploadAssetPackage/mask.png', ['class' => 'pull-left']); ?>
                                <span class="pull-left uploadText">删除选项</span>
                            </div>
                            <?php echo Html::img('@web/image/officeHall/uploadAssetPackage/clos.png',
                                ['class' => 'pull-right uploadImg', 'data-dismiss' => 'modal', 'aria-hidden' => 'true', 'title' => '单击关闭遮罩层', 'style' => 'margin-top: 10px; cursor: pointer;']); ?>
                        </div>
                        <div class="modal-body">
                            <p>您确定删除吗?</p>
                        </div>
                        <div class="modal-footer" style="display: block;">
                            <div class="cancelInConfirm">
                                <input id='modal-confirm' class="cancelInConfirmActive investigation_modal_delete"
                                       type="button" value="确定" data-dismiss="modal"/>
                                <input id="modal-cancel" class="active" type="button" value="取消" data-dismiss="modal"/>
                                <input type="hidden" class="model_upload_excel" value="">
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <input type="hidden" id="delete_excel_modal" data-toggle="modal" data-target="#deleModal"/>
    <!--删除模态框结束-->

<?php
$cssString = <<<CSS
.list-group {
    width:16.2%;
}
.list-group a {width:100%;}
.navbar {
	margin-bottom:0px!image
}
.nav {
    background: #fff;
    height: 60px;
    border-bottom: 1px solid #ccc;
}

.btn:active, .btn.active {
    background-image: none;
    outline: 0;
    -webkit-box-shadow: inset 0 3px 5px rgba(0, 0, 0, .125);
    box-shadow: inset 0 3px 5px rgba(0, 0, 0, .125);
    background-color: #2194f1;
    color: #fff;
}

.content .content-right .importDebtorList .box ul li {
    position: relative;
}
.content .content-right .importDebtorList .box ul li .closeImg{
    position: absolute;
    width: 18px;
    height: 19px;
    right: 20px;
    margin-top: 0px;
}

.modal-body .modal-body-img {
    text-align: center;
    margin: 0 auto;
}

CSS;
$this->registerCss($cssString);
?>

<?php
$js = <<<JS
$(function() {
    var h = $(".content-right").height();
    $(".content-left").height(h);
    $('.myForm').show();
    
    $('#assetPackageName').on('input',function(){
		$('.placeholder').fadeIn(2000)
	});
    
	$('#assetPackageName').on('blur',function(){
		$('.placeholder').fadeOut(2000)
	});
     
    $(window).on('click',function(){
		var h = $(".content-right").height();
		$(".content-left").height(h);
	});

    $(window).scroll(function(){
        var h = $(".content-right").height();
		$(".content-left").height(h);
		//头部导航隐藏
		if(getScrollTop()>60){
			$('.header').hide();
			$('.header').next().css({
				'top':'0'
			})
		}else {
			$('.header').show();
			$('.header').next().css({
				'top':'47px'
			})
		}
	});
    
     //点击图片选中文件
    $('.importDebtorBox .upLoadListBtn img').click(function () {
        $('.importDebtorBox').toggle('displat');
        $('.importDebtorList').toggle('displat');
        $('#continue_upload').show();
        $('#upload_excel').hide();
        $('#input-20').trigger('click');
    })
    //点击继续上传图片
    $('#continue_upload').click(function () {
        $('#upload_excel').hide();
        $('#input-20').trigger('click');
    })
		
    function getScrollTop() {
        var scrollPos;
        if (window.pageYOffset) {
            scrollPos = window.pageYOffset; 
        } else if (document.compatMode && document.compatMode != 'BackCompat') { 
            scrollPos = document.documentElement.scrollTop; 
        } else if (document.body) { 
            scrollPos = document.body.scrollTop; 
        } 
        return scrollPos; 
	}
})
JS;
$this->registerJs($js);
